import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:geomancy/enums/index.dart';
import 'package:geomancy/styles/index.dart';
import 'package:geomancy/tools/constant.dart';
import 'package:geomancy/widgets/common_btn.dart';
import 'package:geomancy/widgets/common_header.dart';
import 'package:geomancy/widgets/common_room_position_tips.dart';
import 'package:geomancy/widgets/common_text.dart';
import 'package:geomancy/widgets/common_title.dart';
import 'package:go_router/go_router.dart';

class HealthPositionTipsPage extends StatefulWidget {
  final String birthday;
  final String sex;
  const HealthPositionTipsPage({super.key, required this.birthday, required this.sex});

  @override
  State<HealthPositionTipsPage> createState() => _HealthPositionTipsPageState();
}

class _HealthPositionTipsPageState extends State<HealthPositionTipsPage> {

  nextHandle() {
    context.push('/start_compass', extra: {
      'source': CompassSource.health,
      "birthday": widget.birthday,
      "sex": widget.sex
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CommonHeader.appBar(context: context),
      backgroundColor: ColorStyle.pageDefaultColor,
      body: SafeArea(
        child: Padding(
          padding: EdgeInsets.fromLTRB(Constant.PAGEPADDING.w, 20.w, Constant.PAGEPADDING.w, Constant.PAGEPADDING.w),
          child: Column(
            children: [
              const CommonTitleWidget(txt: '安康位'),
              Container(
                height: 855.w,
                margin: EdgeInsets.only(top: 20.w),
                padding: EdgeInsets.only(top: 26.w),
                decoration: BoxDecoration(
                    color: ColorStyle.themeLightColor,
                    border: Border.all(width: 5.w, color: ColorStyle.borderColor),
                    borderRadius: BorderRadius.all(Radius.circular(60.w))
                ),
                child: Stack(
                  children: [
                    const Align(
                      alignment: Alignment.topCenter,
                      child: CommonRoomPositionTipsWidget(),
                    ),
                    Positioned(
                      bottom: -5.w,
                      left: -5.w,
                      right: -5.w,
                      child: Container(
                        height: 120.w,
                        padding: EdgeInsets.symmetric(horizontal: 40.w),
                        alignment: Alignment.center,
                        decoration: BoxDecoration(
                            color: ColorStyle.themeLightColor,
                            border: Border.all(width: 5.w, color: ColorStyle.borderColor),
                            borderRadius: BorderRadius.all(Radius.circular(60.w))
                        ),
                        child: CommonText(
                          txt: '请按上图所示，站在空间平面几何中心点，面向入户门，保持手机顶部与户门平行，将手机平置。',
                          fontSize: 24.sp,
                        ),
                      ),
                    ),
                  ],
                ),
              ),
              const Expanded(child: SizedBox()),
              CommonBtnWidget(txt: '下一步', size: Size(590.w, 80.w), onTap: nextHandle)
            ],
          ),
        ),
      ),
    );
  }
}
